cmake_minimum_required(VERSION 3.12)
project(C C)

set(CMAKE_C_STANDARD 11)
aux_source_directory(./src DIR_SRC) #源文件目录(当前目录设置到变量DIR_SRC)
aux_source_directory(./sort DIR_SORT)
aux_source_directory(./array DIR_ARRAY)
aux_source_directory(./stack DIR_STACK)
aux_source_directory(./graph DIR_GRAPH)
add_executable(${PROJECT_NAME} ${DIR_SRC}
        ${DIR_SORT} ${DIR_ARRAY}
        ${DIR_STACK} ${DIR_GRAPH})
find_package(Threads)
target_link_libraries (${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT} m iconv) # pthread库和数学库 iconv库
target_sources(C  PRIVATE ${DIR_SRC}
${DIR_SORT} ${DIR_ARRAY}
${DIR_STACK} ${DIR_GRAPH})